package com.work.formaldehyde.activityadapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.work.formaldehyde.R;
import com.work.formaldehyde.model.JianCeDateModel;

import java.util.ArrayList;

public class JianCeDatesAdapter extends BaseAdapter {
    ArrayList<String> lists;
    Context context;

    public JianCeDatesAdapter(ArrayList<String> lists, Context context) {
        // TODO Auto-generated constructor stub
        this.lists = lists;
        this.context = context;
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return lists != null ? lists.size() : 0;
    }

    @Override
    public Object getItem(int position) {
        // TODO Auto-generated method stub
        return lists != null ? lists.get(position) : 0;
    }

    @Override
    public long getItemId(int position) {
        // TODO Auto-generated method stub
        return position;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub
        convertView = LayoutInflater.from(context).inflate(R.layout.item_jiancedate, null);
        init i = new init();
        i.zhuwotext = convertView.findViewById(R.id.zhuwotext);
        i.wendutext = convertView.findViewById(R.id.wendutext);
        i.shidutext = convertView.findViewById(R.id.shidutext);
        i.jiaquantext = convertView.findViewById(R.id.jiaquantext);
        i.timetext = convertView.findViewById(R.id.timetext);
        String str = lists.get(position);
        i.timetext.setText(str);
        convertView.setTag(i);
        return convertView;
    }

    public static class init {
        //首页list的子控件
        TextView zhuwotext, wendutext, shidutext, jiaquantext, timetext;
    }
}

